package com.cxyd.modules.wms.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cxyd.common.dao.BaseDao;
import com.cxyd.modules.api.dto.request.ContainerCallRequest;
import com.cxyd.modules.api.entity.StockDetailEntity;
import com.cxyd.modules.wms.dto.po.StockAggregatedPo;
import com.cxyd.modules.wms.dto.po.StockPo;
import com.cxyd.modules.wms.dto.po.StockSumPo;
import com.cxyd.modules.wms.entity.StockEntity;
import com.cxyd.modules.wms.excel.StockExcel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 库存信息
 *
 * @author g_Cycle gengruyi01@163.com
 * @since 1.0.0 2023-04-27
 */
@Mapper
public interface StockDao extends BaseDao<StockEntity> {
    IPage<StockEntity> selectViewPage(
            IPage<StockEntity> page,
            @Param("ew") QueryWrapper<StockEntity> wrapper
    );

    List<StockDetailEntity> queryStockList(@Param("parameter") Map<String, Object> parameters);

    IPage<StockEntity> selectCheckStockList(IPage<StockEntity> page, @Param("ew") Wrapper<StockEntity> queryWrapper);

    void procStockFreeze(@Param("parameter") Map<String, Object> parameters);

    int updateStockForSelect(StockPo updateStock);

    List<StockEntity> emptyContainerCall(ContainerCallRequest request);

    List<StockAggregatedPo> selectOrderBySpuNo(@Param("ew") Wrapper<StockAggregatedPo> queryWrapper);

    IPage<StockSumPo> selectSumStockBySpuNo(
            Page<StockSumPo> page,
            @Param("ew") QueryWrapper<StockSumPo> wrapper
    );

    List<StockSumPo> selectSumStockBySpuNo(@Param("ew") QueryWrapper<StockSumPo> wrapper);

    IPage<StockAggregatedPo> selectOrderBySpuNo(
            Page<StockAggregatedPo> page,
            @Param("ew") QueryWrapper<StockAggregatedPo> wrapper
    );

    List<StockAggregatedPo> selectOrderByZoneNo(@Param("ew") Wrapper<StockAggregatedPo> queryWrapper);

    IPage<StockAggregatedPo> selectOrderByZoneNo(
            Page<StockAggregatedPo> page,
            @Param("ew") QueryWrapper<StockAggregatedPo> wrapper
    );

    IPage<StockExcel> selectZonePage(
            Page<StockExcel> page,
            @Param("ew") QueryWrapper<StockExcel> wrapper
    );
}